<template>
    <div class="add_box">
        <input v-model="itemText" @keydown.enter="onAddItem" type="text" placeholder="请输入要添加的内容">
        <button @click="onAddItem">添加</button>
    </div>
</template>

<script>
export default {
    name: "Add",
    data() {
        return {
            itemText: ""
        }
    },
    methods: {
        onAddItem() {
            console.log(this.itemText,this);
            this.Bus.$emit("sendText", this.itemText)
        }
    }
}
</script>

<style scoped lang="scss">
.add_box {
    height: 50px;
    line-height: 50px;
    text-align: center;

    input {
        width: 200px;
        height: 30px;
    }

    button {
        margin-left: 20px;
        width: 50px;
        height: 34px;
    }
}
</style>